flask-{wtf,admin} fixes#156188
Conversation
There was a problem hiding this comment.
| patches = lib.singleton (fetchpatch { | |
| name = "fix-wtforms3.patch"; | |
| url = "https://github.com/coleifer/wtf-peewee/commit/b1764f4474c73a9a2b34ae6b7db61274f5252a7f.patch"; | |
| sha256 = "0maz3fm9bi8p80nk9sdb34xq55xq8ihm51y7k0m8ck9aaypvwbig"; | |
| }); | |
| patches = [ | |
| (fetchpatch { | |
| name = "fix-wtforms3.patch"; | |
| url = "https://github.com/coleifer/wtf-peewee/commit/b1764f4474c73a9a2b34ae6b7db61274f5252a7f.patch"; | |
| sha256 = "0maz3fm9bi8p80nk9sdb34xq55xq8ihm51y7k0m8ck9aaypvwbig"; | |
| }) | |
| ]; |
There was a problem hiding this comment.
This is not how we do such things in pythonPackages. I assume the packages share the module name which means we can't do it like this and need to overwrite it for every end application that we want to fix. This is due to limitations in python which we did not come around yet.
Also if we would add another version it would be in top-level named wtforms_2.
There was a problem hiding this comment.
feel free to suggest an alternative, but I'd rather revert #155221 and override it for the single package that needs 3.0 (which hasn't even been merged yet?) rather than copy-paste this into like 10 different packages :(
I agree that this isn't great, but it's meant as a stop-gap to be removed once the rest of the ecosystem has been updated. Copying it all would hurt me too much to submit, though feel free to amend this PR accordingly (I think that's how that github checkbox works?)
There was a problem hiding this comment.
This is is forbidden. We cannot use it as a stop gap. It causes massive issues when the two versions end up in a single python env. We can also revert the update of wtforms and override it for the one package that actually needs it.
There was a problem hiding this comment.
I think we should check if we can fetch spiral-project/ihatemoney#916.
There was a problem hiding this comment.
| passthru.wtforms2 = flask_wtf.override { | |
| wtforms = wtforms.wtforms2; | |
| }; |
I don't think we even need this.
There was a problem hiding this comment.
Well unless you're applying an overlay to the python package set, anything that indirectly depends on wtforms must also be overridden to keep it out of the closure.
But yes, this can instead be overridden manually everywhere flask_wtf is used, if that's what you mean.
There was a problem hiding this comment.
You want to use something like that https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/privacyidea/default.nix#L6-L39 in the final package.
There was a problem hiding this comment.
We should check if dpgaspar/Flask-AppBuilder#1734 is already enough.
There was a problem hiding this comment.
airflow is so often broken, I don't really care anymore at this point. I would suggest to just leave it like it is and let someone else care about it.
21a147e to
f8bf60e
Compare
f8bf60e to
f756994
Compare
f756994 to
a078be1
Compare
|
@SuperSandro2000 pulled in patches for most of it instead, and omitted airflow |
a078be1 to
2deee80
Compare
|
I'm taking care of ihatemoney in #156350 (it needs some more things because of sqlalchemy-continuum) |
2deee80 to
a0b151c
Compare
There was a problem hiding this comment.
We shouldn't do this. It will cause issues which will be hard to debug.
There was a problem hiding this comment.
so... leave it broken or what do you want here?
buku appears to be the only user of this module, so the override could stay isolated to that.
There was a problem hiding this comment.
yes for python modules (as opposed to leaf packages) it's not possible to override their dependencies. So by bumping wtforms to 3, flask-admin was broken without solution. The only solution to prevent that is not to merge breaking updates in the first place. Please consider that next time before merging.
There was a problem hiding this comment.
Would it help, if we add the version bump of WTForms as an extra package wtforms3? So everything that still relies on WTForms2 could use the original package, any any package needing the version 3, could use wtforms3?
There was a problem hiding this comment.
Would it help, if we add the version bump of WTForms as an extra package
wtforms3? So everything that still relies on WTForms2 could use the original package, any any package needing the version 3, could usewtforms3?
If they both end up in the same pythonEnv things still break because they share the same module name internally.
There was a problem hiding this comment.
I'm not sure what an "empty" package means.
A package that contains no files. That happens when pip installs a package to $out which is already in the environment and then nothing happens except that $out is created and some directories and that ends up being the package.
of course once flask-admin is properly updated then this override would be obviously unneeded and removed.
Lets be real, there is a high chance someone will forget.
I'm not really aware of python version overrides being uncommon practice in nixpkgs
We nuked most of them from the tree a few months ago so except pytest there should be almost none.
There was a problem hiding this comment.
I'm not sure what an "empty" package means.
A package that contains no files. That happens when pip installs a package to
$outwhich is already in the environment and then nothing happens except that$outis created and some directories and that ends up being the package.
Well that's unfortunate as a failure case, but is a much more extraordinary case that isn't relevant here - plus could easily be guarded against if it were a real concern. A package that accidentally depends on itself if it weren't overridden would cause infinite recursion on evaluation, no? A situation where that is narrowly avoided due to a stray override seems like it would be an incredibly exceptional one. You'd also hope installtests would catch it, but .-.
of course once flask-admin is properly updated then this override would be obviously unneeded and removed.
Lets be real, there is a high chance someone will forget.
Sorry, I want to say I highly doubt your statement here, as it would be immediately obvious to anyone looking at the file to update it. Perhaps not to newcomers, though? and then if github doesn't show it in the diff... though, you could apply that as an argument to reject literally any change in nixpkgs, so it doesn't feel very useful?
I'm not really aware of python version overrides being uncommon practice in nixpkgs
We nuked most of them from the tree a few months ago so except pytest there should be almost none.
Gotcha, well it sucks that this was apparently done without any alternatives proposed. Is any of this policy documented somewhere?
(but really, the fact that nixpkgs allows merges to break any package is honestly the real problem here, unfortunately)
There was a problem hiding this comment.
is a much more extraordinary case that isn't relevant here
I already got this once into master and unstable for 3 weeks and no one noticed that the checkInput poluted the environment and the package ended up being empty. 🙃
A package that accidentally depends on itself if it weren't overridden would cause infinite recursion on evaluation, no?
For nix they are two different packages but for python not and we currently do not have any safeguard for this.
Gotcha, well it sucks that this was apparently done without any alternatives proposed
Limitation of python which cannot easily and universally overcome.
Is any of this policy documented somewhere?
IDK, probably not.
There was a problem hiding this comment.
Flask-admin got updated to version 1.6.0 which includes an update to WTForms 3:
1.6.0
Dropped Python 2 support
WTForms 3.0 support
Various fixes
I build it locally and it works flawlessly with WTForms3. The only thing I needed to change was to add flask_admin/tests/sqla/test_inlineform.py to disabledTestPaths.
There was a problem hiding this comment.
Yeah it seems good here, replaced the override with the update!
a0b151c to
39b2cf9
Compare
|
This is a semi-automatic executed nixpkgs-review with nixpkgs-review-checks extension. It is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch). Result of 8 packages built:
|
Motivation for this change
#155221 (comment) broke a number of packages, most of which haven't been updated or released with support for wtforms 3.0 yet. This selectively overrides the dependency for the affected packages.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notescc @gador @SuperSandro2000